home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / comm / jmod311.zip / JMODEM_C.XYW < prev    next >
Text File  |  1992-02-02  |  35KB  |  568 lines

  1. «LM10»«RM70»«FC»
  2. J M O D E M
  3. *  The Microsoft C Version  *
  4. «DA»
  5. Richard B. Johnson
  6. 405 Broughton Drive
  7. Beverly Massachusetts 01915
  8. BBS (508) 922-3166
  9. «FL»«RFA«FC»- «PN» -
  10. «FL»»«RHA«FR»JMODEM, the C Version  «PG»
  11. «FL»
  12.  
  13. »
  14. Introduction.
  15.  
  16. JMODEM was first introduced about two years ago. It has en~joyed a steady increase in popularity around the world. It has even been explained in some detail in John Dvorak's book on PC communications; Dvorak's Guide to PC Telecommunica~tions, 1990, Osborne-McGraw-Hill, 2600 Tenth Street, Berkeley, CA.
  17.  
  18. JMODEM was first written in assembly language. Since this language is hard to read and use, it has been difficult for communications program developers to incorporate it into their programs directly. Instead it must be executed as an external protocol. Now JMODEM has been written in the C Language. C has become the de-facto standard for portable code development even though there isn't presently any code that is truly portable across many different machines. The writing of JMODEM in C will make it easier for software de~velopers throughout the world to use this very useful pro~tocol.
  19.  
  20. You can use this new version of JMODEM just as the older versions written in assembly. It has a new color sign-on screen and status-block windows that overlap. Although the new JMODEM.EXE code is larger than the assembly-language version, JMODEM.COM, the program still executes very fast because much effort has been taken to streamline the C code. JMODEM.COM required 64 k of RAM (one segment) to execute properly. JMODEM.EXE requires 79 k to allow the screens to be written properly, and 66 k of free RAM to execute without aborting although the previous screen content will be lost. Like all versions of JMODEM, this version is 100% compatible with all previous version including Beta version 1.00. From it's inception, the essential structure of JMODEM has never been changed.
  21.  
  22. How to install JMODEM.
  23.  
  24. JMODEM executes best from a batch file as an external pro~tocol for any of the communications programs that have ex~ternal-protocol capability. A typical communications program is TELIX.
  25. «NB»
  26. Here is a batch file used with TELIX for uploads:
  27.  
  28. @ECHO OFF
  29. Rem * JMODEM TELIX Upload batch file.
  30. C:\TELIX\JMODEM S1 %3
  31. Rem           | ||  |_________ file name (passed by TELIX)
  32. Rem           | ||____________ COM port (1 - 4)
  33. Rem           | |_____________ Send
  34. Rem           |_______________ Path and name of JMODEM
  35. «BB»
  36. «NB»
  37. This is a batch file used with TELIX for downloads:
  38.  
  39. @ECHO OFF
  40. Rem * JMODEM TELIX Download batch file.
  41. C:\TELIX\JMODEM R1 %3
  42. Rem           | ||  |_________ file name (passed by TELIX)
  43. Rem           | ||____________ COM port (1 - 4)
  44. Rem           | |_____________ Receive
  45. Rem           |_______________ Path and name of JMODEM
  46. «BB»
  47. «NB»
  48. This is a batch file used for PCPLUS (PROCOMM) uploads:
  49.  
  50. @ECHO OFF
  51. Rem * JMODEM PCPLUS Upload batch file.
  52. C:\TELIX\JMODEM S1 %1
  53. Rem           | ||  |_________ file name (passed by PCPLUS)
  54. Rem           | ||____________ COM port (1 - 4)
  55. Rem           | |_____________ Send
  56. Rem           |_______________ Path and name of JMODEM
  57. «BB»
  58. «NB»
  59. This is a batch file for PCPLUS (PROCOMM) ownloads:
  60.  
  61. @ECHO OFF
  62. Rem * JMODEM PCPLUS Download batch file.
  63. C:\TELIX\JMODEM R1 %1
  64. Rem           | ||  |_________ file name (passed by PCPLUS)
  65. Rem           | ||____________ COM port (1 - 4)
  66. Rem           | |_____________ Receive
  67. Rem           |_______________ Path and name of JMODEM
  68. «PG»
  69. If I wished to receive in the "batch" mode, I could make a file like this. Notice that some communications programs do not allow multiple file names. Note that the comments "!" are NOT ALLOWED in a DOS batch file.
  70.  
  71.         :DO_LOOP           ! Return here
  72.         IF "%3" == "" GOTO DONE       ! More parameters?
  73.         C:\TELIX\JMODEM R1 %3       ! Execute JMODEM
  74.         IF ERRORLEVEL 1 GOTO DONE  ! Abort on error
  75.         SHIFT               ! %4 becomes %3
  76.         GOTO DO_LOOP           ! Continue
  77.         :DONE               ! Exit batch file
  78.  
  79. If you do not know what "%" parameters are used to pass the file name, all you have to do is make a "dummy" batch file that contains the following:
  80.  
  81.         @ECHO OFF
  82.         ECHO %1
  83.         ECHO %2
  84.         ECHO %3
  85.         ECHO %4
  86.         ECHO %5
  87.         PAUSE
  88.  
  89. When this is executed, you will see something like this:
  90.  
  91.     1200
  92.     1
  93.     FILENAME.TYP
  94.     ECHO is off
  95.     ECHO is off
  96.     Strike a key when ready . . .
  97.  
  98. The first line contains "1200" which is the baud rate. This means that the %1 parameter contains the baud rate.
  99.  
  100. The second line contains "1" which is the communications adapter port being used. This means that the port is being passed as the %2 parameter.
  101.  
  102. The third line contains "FILENAME.TYP" which is the file name. This means that the file name is being passed as the %3 parameter.
  103.  
  104. The fourth and fifth lines contain nothing to echo so DOS replies the current state of the echo function which is "off".
  105.  
  106. PCPLUS handles the file name passing a little bit different. If I execute the same "dummy" batch file from the PCPLUS directory, the response is:
  107.  
  108.     FILENAME.TYP
  109.     ECHO is off
  110.     ECHO is off
  111.     ECHO is off
  112.     ECHO is off
  113.     Strike a key when ready . . .
  114.  
  115. This shows us that PCPLUS passes the file name as the first parameter and there are no other parameters. However, If I put more parameters on the command line within PCPLUS, they will get sent to the batch file. The response is:
  116.  
  117.     FILENAME.001
  118.     FILENAME.002
  119.     FILENAME.003
  120.     FILENAME.
  121.     ECHO is off
  122.     Strike a key when ready . . .
  123.  
  124. Therefore PCPLUS allows up to four file names to be passed providing there's room on the command line.
  125.  
  126. Notice that these two communications programs check the default directory for the external protocol batch file FIRST! Therefore you must make certain that there are no other similarly-named batch files in the current directory or within the current path. Failure to do so will cause the improper execution of the wrong batch file. Lets say that the path was "C:\DOS;C:\TOOLS;C:\PCPLUS;C:\TELIX;C:\QMODEM". If you named all your JMODEM external protocol batch files with the same name, and you were attempting to use an ex~ternal file transfer protocol from QMODEM, the batch file designed to operate with PCPLUS would be the first one "found" and executed since the search-path will search the \PCPLUS directory before the \QMODEM directory. You prevent the execution of the incorrect batch file by calling them slightly different names.
  127.  
  128. When setting up external protocols, remember to configure the communications program so that it prompts you for the file names. Unlike some protocols, JMODEM does not transfer the file name. You can use any file name that you wish. You must pass the file name to JMODEM since it must know the name of the file being transmitted or received. There are no defaults.
  129.  
  130. Version V3.09 adds support for absolute port addresses and IRQ numbers. This allows one to use multiple boards that use strange ports and interrupt levels. This also allows one to thoroughly screw up his system by writing to the wrong ports by accident. JMODEM now accepts:
  131.  
  132.     JMODEM R(3F8:4) filename.typ
  133.  
  134.     ... for an input string as well as the generic port number. In this case, "3F8" is the hexadecimal port address and "4" is the IRQ number. The delimiters are required. Be very careful when using this new feature. Writes to incor~rect port addresses can destroy the contents of hard disks, etc. JMODEM has no way of "knowing" if you give it the wrong address to use. The complete input specification for the new feature is:
  135.  
  136.     JMODEM R(2F8:3) filename.typ
  137.              |   | |  |____________ filename
  138.              |   | |_______________ IRQ to use
  139.              |   |_________________ hex port address
  140.              |_____________________ Receive.
  141.  
  142.     JMODEM S(2F8:3) filename.typ
  143.              |   | |  |____________ filename
  144.              |   | |_______________ IRQ to use
  145.              |   |_________________ hex port address
  146.              |_____________________ Send.
  147.  
  148. There must be no spaces between the "X(YYY:Z)" syntax. This means that if your batch file gets its parameters from an environment variable, it must be parsed like this:
  149.  
  150.     JMODEM S(%PORT